home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Developers / XAMPP 1.5.4 / Windows installer / xampp-win32-1.5.4-installer.exe / xampp / php / peardev.bat < prev    next >
Encoding:
DOS Batch File  |  2005-12-05  |  5.5 KB  |  136 lines

  1. @ECHO OFF
  2.  
  3. REM ----------------------------------------------------------------------
  4. REM PHP version 5
  5. REM ----------------------------------------------------------------------
  6. REM Copyright (c) 1997-2004 The PHP Group
  7. REM ----------------------------------------------------------------------
  8. REM  This source file is subject to version 3.0 of the PHP license, 
  9. REM  that is bundled with this package in the file LICENSE, and is
  10. REM  available at through the world-wide-web at
  11. REM  http://www.php.net/license/3_0.txt. 
  12. REM  If you did not receive a copy of the PHP license and are unable to
  13. REM  obtain it through the world-wide-web, please send a note to
  14. REM  license@php.net so we can mail you a copy immediately.
  15. REM ----------------------------------------------------------------------
  16. REM  Authors:     Alexander Merz (alexmerz@php.net)
  17. REM ----------------------------------------------------------------------
  18. REM
  19. REM  $Id: peardev.bat,v 1.2 2005/03/21 15:23:43 cellog Exp $
  20.  
  21. REM change this lines to match the paths of your system
  22. REM -------------------
  23.  
  24.  
  25. REM Test to see if this is a raw pear.bat (uninstalled version)
  26. SET TMPTMPTMPTMPT=@includ
  27. SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
  28. FOR %%x IN ("\xampp\php\pear") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
  29.  
  30. REM Check PEAR global ENV, set them if they do not exist
  31. IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=\xampp\php\pear"
  32. IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=\xampp\php"
  33. IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=%PHP_PEAR_BIN_DIR%\php.exe"
  34. IF "%PHP_PEAR_SYSCONF_DIR%"=="" SET "PHP_PEAR_SYSCONF_DIR=%PHP_PEAR_BIN_DIR%"
  35. IF "%PHP_PEAR_EXTENSION_DIR%"=="" SET "PHP_PEAR_EXTENSION_DIR=%PHP_PEAR_BIN_DIR%\ext"
  36. IF "%PHP_PEAR_DOC_DIR%"=="" SET "PHP_PEAR_DOC_DIR=%PHP_PEAR_INSTALL_DIR%\docs"
  37. IF "%PHP_PEAR_DATA_DIR%"=="" SET "PHP_PEAR_DATA_DIR=%PHP_PEAR_INSTALL_DIR%\data"
  38. IF "%PHP_PEAR_TEST_DIR%"=="" SET "PHP_PEAR_TEST_DIR=%PHP_PEAR_INSTALL_DIR%\tests"
  39. IF "%PHP_PEAR_CACHE_DIR%"=="" SET "PHP_PEAR_CACHE_DIR=\xampp\tmp"
  40. GOTO :INSTALLED
  41.  
  42. :NOTINSTALLED
  43. ECHO WARNING: This is a raw, uninstalled pear.bat
  44.  
  45. REM Check to see if we can grab the directory of this file (Windows NT+)
  46. IF %~n0 == pear (
  47. FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" (
  48. SET "PHP_PEAR_PHP_BIN=%%~$PATH:x"
  49. echo Using PHP Executable "%PHP_PEAR_PHP_BIN%"
  50. "%PHP_PEAR_PHP_BIN%" -v
  51. GOTO :NEXTTEST
  52. ))
  53. GOTO :FAILAUTODETECT
  54. :NEXTTEST
  55. IF "%PHP_PEAR_PHP_BIN%" NEQ "" (
  56.  
  57. REM We can use this PHP to run a temporary php file to get the dirname of pear
  58.  
  59. echo ^<?php $s=getcwd^(^);chdir^($a=dirname^(__FILE__^).'\\'^);if^(stristr^($a,'\\scripts'^)^)$a=dirname^(dirname^($a^)^).'\\';$f=fopen^($s.'\\~a.a','wb'^);echo$s.'\\~a.a';fwrite^($f,$a^);fclose^($f^);chdir^($s^);?^> > ~~getloc.php
  60. "%PHP_PEAR_PHP_BIN%" ~~getloc.php
  61. set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a
  62. DEL ~a.a
  63. DEL ~~getloc.php
  64. set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"
  65.  
  66. REM Make sure there is a pearcmd.php at our disposal
  67.  
  68. IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php (
  69. IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
  70. IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
  71. IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
  72. )
  73. )
  74. GOTO :INSTALLED
  75. ) ELSE (
  76. REM Windows Me/98 cannot succeed, so allow the batch to fail
  77. )
  78. :FAILAUTODETECT
  79. echo WARNING: failed to auto-detect pear information
  80. :INSTALLED
  81.  
  82. REM Check Folders and files
  83. IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
  84. IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
  85. IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
  86. IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
  87. ATTRIB +R %PHP_PEAR_BIN_DIR%\pear.bat >nul
  88. ATTRIB +R %PHP_PEAR_BIN_DIR%\peardev.bat >nul
  89. ATTRIB +R %PHP_PEAR_BIN_DIR%\pecl.bat >nul
  90. ATTRIB +R %PHP_PEAR_BIN_DIR%\phpdoc.bat >nul
  91. ATTRIB +R %PHP_PEAR_BIN_DIR%\phpunit.bat >nul
  92. ATTRIB -H %PHP_PEAR_INSTALL_DIR%\.depdb >nul
  93. ATTRIB -H %PHP_PEAR_INSTALL_DIR%\.depdblock >nul
  94. ATTRIB -H %PHP_PEAR_INSTALL_DIR%\.filemap >nul
  95. ATTRIB -H %PHP_PEAR_INSTALL_DIR%\.lock >nul
  96. REM launch pearcmd
  97. GOTO RUN
  98. :PEAR_INSTALL_ERROR
  99. ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
  100. ECHO Please fix it using your environment variable or modify
  101. ECHO the default value in pear.bat
  102. ECHO The current value is:
  103. ECHO %PHP_PEAR_INSTALL_DIR%
  104. GOTO END
  105. :PEAR_INSTALL_ERROR2
  106. ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
  107. ECHO pearcmd.php could not be found there.
  108. ECHO Please fix it using your environment variable or modify
  109. ECHO the default value in pear.bat
  110. ECHO The current value is:
  111. ECHO %PHP_PEAR_INSTALL_DIR%
  112. GOTO END
  113. :PEAR_BIN_ERROR
  114. ECHO PHP_PEAR_BIN_DIR is not set correctly.
  115. ECHO Please fix it using your environment variable or modify
  116. ECHO the default value in pear.bat
  117. ECHO The current value is:
  118. ECHO %PHP_PEAR_BIN_DIR%
  119. GOTO END
  120. :PEAR_PHPBIN_ERROR
  121. ECHO PHP_PEAR_PHP_BIN is not set correctly.
  122. ECHO Please fix it using your environment variable or modify
  123. ECHO the default value in pear.bat
  124. ECHO The current value is:
  125. ECHO %PHP_PEAR_PHP_BIN%
  126. GOTO END
  127. :RUN
  128. "%PHP_PEAR_PHP_BIN%" -C -d memory_limit="-1" -d output_buffering=1 -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
  129. :END
  130. ATTRIB -R %PHP_PEAR_BIN_DIR%\pear.bat >nul
  131. ATTRIB -R %PHP_PEAR_BIN_DIR%\peardev.bat >nul
  132. ATTRIB -R %PHP_PEAR_BIN_DIR%\pecl.bat >nul
  133. ATTRIB -R %PHP_PEAR_BIN_DIR%\phpdoc.bat >nul
  134. ATTRIB -R %PHP_PEAR_BIN_DIR%\phpunit.bat >nul
  135. @ECHO ON
  136.